package Week3.num.week3Test1.opp02ex;

public class ColaEmployee {
    /**
     * 员工姓名
     */
    public String name;
    /**
     * 员工生日月份
     */
    public int birthMonth;
    /**
     * 员工工资
     */
    double salary;

    /**
     * 空参构造
     */
    public ColaEmployee() {

    }

    /**
     * 全参构造
     */
    public ColaEmployee(String name, int birthMonth) {
        this.name = name;
        this.birthMonth = birthMonth;
    }

    /**
     * 计算员工工资的方法
     *
     * @param month 发放工资需计算的月份
     * @return 员工的工资
     */
    public double getSalary(int month) {
        if (month > 12 || month < 1) {
            return 0.0;
        }
        if (month == this.birthMonth) {
            this.salary = this.salary + 100;
        }
        return salary;
    }
}
